home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 16 / PC Actual CD 16.iso / autocad / R14701.DXR / 00008_Utilities - from slideshow.ls < prev    next >
Encoding:
Text File  |  1997-04-24  |  8.0 KB  |  295 lines

  1. on clickedOnFieldLIne myLineNum, myField, myInitLineNum, myShiftDown
  2.   if the type of member myField <> #field then
  3.     exit
  4.   end if
  5.   if (myLineNum < 1) or (myLineNum > the number of lines in field myField) then
  6.     hilite line the number of lines in field myField + 1 of field myField
  7.     return 0
  8.   else
  9.     if (myShiftDown = 1) and (myInitLineNum > 0) and (myInitLineNum <> myLineNum) then
  10.       if myInitLineNum > myLineNum then
  11.         set temp to myLineNum
  12.         set myLineNum to myInitLineNum
  13.         set myInitLineNum to temp
  14.       end if
  15.       if myInitLineNum = 1 then
  16.         set tFirstChar to 1
  17.       else
  18.         set tFirstChar to length(line 1 to myInitLineNum - 1 of field myField) + 2
  19.       end if
  20.       hilite char tFirstChar to length(line 1 to myLineNum of field myField) + 1 of field myField
  21.       return [myInitLineNum, myLineNum]
  22.     else
  23.       if myLineNum = 1 then
  24.         set tFirstChar to 1
  25.       else
  26.         set tFirstChar to length(line 1 to myLineNum - 1 of field myField) + 2
  27.       end if
  28.       hilite char tFirstChar to length(line 1 to myLineNum of field myField) + 1 of field myField
  29.       return myLineNum
  30.     end if
  31.   end if
  32. end
  33.  
  34. on moveLineInField myLineNum, myField, myDirection, myCoordList
  35.   if myLineNum = 0 then
  36.     exit
  37.   end if
  38.   if the last line in field myField = RETURN then
  39.     set tNumOfLines to the number of lines in field myField - 1
  40.   else
  41.     set tNumOfLines to the number of lines in field myField
  42.   end if
  43.   if voidp(myCoordList) then
  44.     set tListFlag to 0
  45.   else
  46.     set tListFlag to 1
  47.   end if
  48.   set tCurrLineText to line myLineNum of field myField
  49.   if tListFlag then
  50.     set tCurrListItem to getAt(myCoordList, myLineNum)
  51.   end if
  52.   case myDirection of
  53.     #up:
  54.       if myLineNum = 1 then
  55.         return [#line: myLineNum, #list: myCoordList]
  56.       end if
  57.       delete line myLineNum of field myField
  58.       if tListFlag then
  59.         deleteAt(myCoordList, myLineNum)
  60.       end if
  61.       set myLineNum to myLineNum - 1
  62.       put tCurrLineText & RETURN before line myLineNum of field myField
  63.       if tListFlag then
  64.         addAt(myCoordList, myLineNum, tCurrListItem)
  65.       end if
  66.     #down:
  67.       if myLineNum = tNumOfLines then
  68.         return [#line: myLineNum, #list: myCoordList]
  69.       end if
  70.       delete line myLineNum of field myField
  71.       if tListFlag then
  72.         deleteAt(myCoordList, myLineNum)
  73.       end if
  74.       put RETURN & tCurrLineText after line myLineNum of field myField
  75.       set myLineNum to myLineNum + 1
  76.       if tListFlag then
  77.         addAt(myCoordList, myLineNum, tCurrListItem)
  78.       end if
  79.   end case
  80.   clickedOnFieldLIne(myLineNum, myField)
  81.   return [#line: myLineNum, #list: myCoordList]
  82. end
  83.  
  84. on puppetAllSprites myState
  85.   repeat with tSprite = 1 to 48
  86.     set the puppet of sprite tSprite to myState
  87.   end repeat
  88. end
  89.  
  90. on wait myTicks
  91.   set tTicks to the ticks
  92.   repeat while the ticks < (tTicks + myTicks)
  93.     nothing()
  94.   end repeat
  95. end
  96.  
  97. on doesXtraExist myXtraName
  98.   set tFoundXtra to 0
  99.   repeat with i = 1 to the number of xtras
  100.     if the name of xtra(i) = myXtraName then
  101.       set tFoundXtra to 1
  102.       exit repeat
  103.     end if
  104.   end repeat
  105.   return tFoundXtra
  106. end
  107.  
  108. on findFile myPath, myFile
  109.   if doesXtraExist("fileIO") then
  110.     set tFileIO to new(xtra("fileIO"))
  111.     if the last char in myPath <> "\" then
  112.       put "\" after myPath
  113.     end if
  114.     openFile(tFileIO, myPath & myFile, 1)
  115.     if status(tFileIO) = 0 then
  116.       set tFoundFile to 1
  117.     else
  118.       set tFoundFile to 0
  119.     end if
  120.     closeFile(tFileIO)
  121.     set tFileIO to 0
  122.   else
  123.     set tFoundFile to 0
  124.     repeat with i = 1 to the maxinteger
  125.       set tFileName to getNthFileNameInFolder(myPath, i)
  126.       if tFileName = EMPTY then
  127.         exit repeat
  128.       end if
  129.       if tFileName = myFile then
  130.         set tFoundFile to 1
  131.         exit repeat
  132.       end if
  133.     end repeat
  134.   end if
  135.   return tFoundFile
  136. end
  137.  
  138. on buildFileListByType myPath, myFileType, myStringExtensionFlag
  139.   set tReturnList to []
  140.   sort(tReturnList)
  141.   repeat with i = 1 to the maxinteger
  142.     set tFileName to getNthFileNameInFolder(myPath, i)
  143.     if tFileName = EMPTY then
  144.       exit repeat
  145.     end if
  146.     if getFileType(tFileName) = myFileType then
  147.       if myStringExtensionFlag = 1 then
  148.         add(tReturnList, getFileNameOnly(tFileName))
  149.         next repeat
  150.       end if
  151.       add(tReturnList, tFileName)
  152.     end if
  153.   end repeat
  154.   return tReturnList
  155. end
  156.  
  157. on linearListToString myList
  158.   if not ilk(myList, #linearList) then
  159.     exit
  160.   end if
  161.   set tReturnString to EMPTY
  162.   repeat with tEntry in myList
  163.     put tEntry & RETURN after tReturnString
  164.   end repeat
  165.   delete char -30000 of tReturnString
  166.   return tReturnString
  167. end
  168.  
  169. on changeCastlib myCastlibNum
  170.   beginRecording()
  171.   repeat with i = 1 to 48
  172.     set the castLibNum of sprite i to myCastlibNum
  173.   end repeat
  174.   endRecording()
  175. end
  176.  
  177. on putCharIntoAllFields myChar, myCastlibNum
  178.   repeat with i = 1 to the number of castMembers of castLib myCastlibNum
  179.     if the type of member i of castLib myCastlibNum <> #field then
  180.       next repeat
  181.     end if
  182.     put myChar into field i of castLib myCastlibNum
  183.   end repeat
  184. end
  185.  
  186. on getFileType myFilename
  187.   set tOldDelimiter to the itemDelimiter
  188.   set the itemDelimiter to "."
  189.   set tFileType to item 2 of myFilename
  190.   set the itemDelimiter to tOldDelimiter
  191.   if tFileType = EMPTY then
  192.     return 0
  193.   else
  194.     return tFileType
  195.   end if
  196. end
  197.  
  198. on getFileNameOnly myFilename
  199.   set tOldDelimiter to the itemDelimiter
  200.   set the itemDelimiter to "."
  201.   set tFileName to item 1 of myFilename
  202.   set the itemDelimiter to tOldDelimiter
  203.   if tFileName = EMPTY then
  204.     return 0
  205.   else
  206.     return tFileName
  207.   end if
  208. end
  209.  
  210. on getCDPath myPath, myTokenFile, myStartLetter, myEndLetter
  211.   if char 3 of myPath = "\" then
  212.     delete char 1 to 2 of myPath
  213.   end if
  214.   if (char 1 of myPath <> "\") or (the last char in myPath <> "\") then
  215.     alert("Invalid path specified for getDriveLetter() function")
  216.     halt()
  217.   end if
  218.   repeat with tDriveChar = charToNum(myStartLetter) to charToNum(myEndLetter)
  219.     set tPath to numToChar(tDriveChar) & ":" & myPath
  220.     if findFile(tPath, myTokenFile) then
  221.       return numToChar(tDriveChar) & ":" & myPath
  222.     end if
  223.   end repeat
  224.   alert("The CD-ROM was not found in any drive on your system.  " & "Please make sure it is inserted properly.")
  225.   halt()
  226. end
  227.  
  228. on exitprocedure
  229.   set the windowList to []
  230.   halt()
  231. end
  232.  
  233. on ExitMIAW
  234.   global gDialogbox
  235.   set gDialogbox to window "ExitMIAW"
  236.   set the windowType of window 1 to 2
  237.   set the rect of gDialogbox to the rect of the stage
  238.   open(gDialogbox)
  239. end
  240.  
  241. on getCurrPalette
  242.   global gCurrTopicObj, gStagePalNum
  243.   if objectp(gCurrentTopicObj) then
  244.     return the number of member the pPalette of gCurrTopicObj
  245.   else
  246.     return 0
  247.   end if
  248. end
  249.  
  250. on shiftList myList, myDirection
  251.   if not ilk(myList, #propList) then
  252.     return 0
  253.   end if
  254.   set tNewList to [:]
  255.   case myDirection of
  256.     #prev:
  257.       addProp(tNewList, #curr, the prev of myList)
  258.       addProp(tNewList, #next, the curr of myList)
  259.       addProp(tNewList, #prev, the next of myList)
  260.     #next:
  261.       addProp(tNewList, #curr, the next of myList)
  262.       addProp(tNewList, #next, the prev of myList)
  263.       addProp(tNewList, #prev, the curr of myList)
  264.     otherwise:
  265.       return 0
  266.   end case
  267.   return tNewList
  268. end
  269.  
  270. on addPropListToPropList myOrigList, myListToAdd
  271.   if not ilk(myOrigList, #propList) or not ilk(myListToAdd, #propList) then
  272.     return 0
  273.   end if
  274.   set tNumOfElementsToAdd to count(myListToAdd)
  275.   repeat with i = 1 to tNumOfElementsToAdd
  276.     set tNewProp to getPropAt(myListToAdd, i)
  277.     if not voidp(getaProp(myOrigList, tNewProp)) then
  278.       alert("addPropListToPropList: Probably, two slides have the same name of: " & tNewProp)
  279.     end if
  280.     set tNewElem to getAt(myListToAdd, i)
  281.     addProp(myOrigList, tNewProp, tNewElem)
  282.   end repeat
  283.   return myOrigList
  284. end
  285.  
  286. on removeLFCharFromText myInputText
  287.   set tNumberOfLines to the number of lines in myInputText
  288.   repeat with tCurrLineNum = 1 to tNumberOfLines
  289.     if charToNum(char 1 of line tCurrLineNum of myInputText) = 10 then
  290.       delete char 1 of line tCurrLineNum of myInputText
  291.     end if
  292.   end repeat
  293.   return myInputText
  294. end
  295.